﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DevComponents.DotNetBar;

namespace Presentation
{
    public partial class frmMain :Form// DevComponents.DotNetBar.Office2007Form
    {
        public frmMain()
        {
            InitializeComponent();
        }

        private void frmMain_Load(object sender, EventArgs e)
        {

        }

        private void buttonItem21_Click(object sender, EventArgs e)
        {

        }

        private void mnuTheLoai_Click(object sender, EventArgs e)
        {
            showTabTheLoai();
            
        }

        private void tabMain_TabItemClose(object sender, DevComponents.DotNetBar.TabStripActionEventArgs e)
        {
            
        }

        private void tabMain_TabItemClose_1(object sender, DevComponents.DotNetBar.TabStripActionEventArgs e)
        {
            frmTheLoai tl = this.ActiveMdiChild as frmTheLoai;
            tl.Close();
        }

        private void showTabTheLoai()
        {
            for (int i = 0; i < tabMain.Tabs.Count;i++)
            {
                if(tabMain.Tabs[i].Name=="TheLoai")
                {
                    tabMain.SelectedTabIndex = i;
                    return;
                }
            }

            frmTheLoai tl = new frmTheLoai();
            tl.MdiParent = this;
            //tl.TopLevel = false;
            //tl.Dock = DockStyle.Top;
            TabItem tab = tabMain.CreateTab("TheLoai");
            tab.Name = "TheLoai";
            tab.Text = "Quản lý thể loại";
            tab.AttachedControl.Controls.Add(tl);
            tabMain.SelectedTab = tab;
            tl.Show();
            tl.Dock = DockStyle.Fill;
            this.ActivateMdiChild(tl);

        }
        
    }
}
